
#include<stdio.h>
#include<stdbool.h>
bool ToFind(int x)
{
	int flag = 1,num = 0;
	x/=100;
	while(x)
	{
		if(num%2 == 0 && x%2 == 0)
		 {
		 	flag = 0;
		 	break;
		 }
		if(num%2 != 0 && x%2 != 0)
		{
			flag = 0;
			break;
		}
		 x/=10;
		 num++;
	}
	if(flag == 1)
		return true;
	else
		return false;
}
int main()
{
	int n =0;
	scanf("%d",&n);
	int count = 0;
	int i =0;
	for(i=1;i<=n;i+=2)
	{
		if((i/10)%2 == 0)
		{
			if(ToFind(i))
			{
				count++;
				//printf("%d ",i );
			}
		}
	}
	printf("\n%d",count);
	return 0;
 } 
